//
//  PayMethodView.m
//  QuanJieShopProject
//
//  Created by SunChao on 2018/6/8.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "PayMethodView.h"

@implementation PayMethodView
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {  //初始化按钮
        
        _imgView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 10, 30, 30)];
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, 10, 200, 30)];
       
        _selBtn = [UIButton buttonWithType:0];
        _selBtn.frame = CGRectMake(UISCREEN_WIDTH-50, 10, 30, 30);
        _scoreLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(_selBtn.frame)-100, 10, 100, 30)];
        _scoreLabel.textColor = [UIColor redColor];
        //将按钮添加到自身
        [self addSubview:_imgView];
        [self addSubview:_titleLabel];
        [self addSubview:_selBtn];
        [self addSubview:_scoreLabel];
    }
    return self;
}

- (void)setViewWithImage:(NSString *)image title:(NSString *)title score:(NSString *)score{
    
    self.userInteractionEnabled = YES;
    self.imgView.image = [UIImage imageNamed:image];
    self.titleLabel.text = title;
    self.scoreLabel.text = score;
    [self.selBtn setImage:[UIImage imageNamed:@"Snoselect"] forState:UIControlStateNormal];
    [self.selBtn setImage:[UIImage imageNamed:@"Sselect"] forState:UIControlStateSelected];
}

@end
